home *** CD-ROM | disk | FTP | other *** search
/ Aminet 22 / Aminet 22 (1997)(GTI - Schatztruhe)[!][Dec 1997].iso / Aminet / dev / e / amigae33a.lha / E_v3.3a / Src.lha / Src / Afc / SetAttrs_Example.e < prev    next >
Text File  |  1997-09-09  |  989b  |  52 lines

  1. /*
  2. ** DirList_Example 3
  3. **
  4. ** Methods: setdir(), read(), sort(), first(), obj()
  5. **          succ(), dirname(), setattrs()
  6. **
  7. **
  8. ** This code is placed in Public Domain
  9. **
  10. ** (C)Copyright 1996 Fabio Rotondo
  11. **
  12. */
  13.  
  14.  
  15. MODULE 'afc/DirList',       -> Our MAGIC MODULE!
  16.        'afc/explain_exception'
  17.  
  18. PROC main() HANDLE
  19.   DEF dl:PTR TO dirlist
  20.  
  21.   NEW dl.dirlist()
  22.  
  23.  
  24.   dl.setattrs([DIRTAG_COMPLETEPATH, TRUE, -> We want TO store the complete path
  25.               DIRTAG_MARKDIR, TRUE,     -> AND we want DirList TO mark dirs
  26.               0,0
  27.              ])
  28.  
  29.  
  30.  
  31.   dl.setdir('ram:')      -> We'll scan RAM:
  32.   WriteF('Reading...\n')
  33.   dl.read(TRUE, TRUE)    -> Here we read it
  34.   WriteF('Sorting...')
  35.   dl.sort(TRUE)          -> AND here we sort it
  36.  
  37.   WriteF('Done!\n')
  38.  
  39.   IF dl.first()          -> Let's show!
  40.     REPEAT
  41.       WriteF('\s\n',dl.obj())
  42.     UNTIL dl.succ()=FALSE
  43.   ENDIF
  44.  
  45.   WriteF('DIR:\s\n', dl.dirname())  -> Actual dir name is this
  46.  
  47. EXCEPT DO
  48.   explain_exception()
  49.   END dl
  50. ENDPROC
  51.  
  52.